<?php

/**
 * This is the model class for table "puskesmaspelayanan".
 *
 * The followings are the available columns in table 'puskesmaspelayanan':
 * @property integer $ppl_id
 * @property integer $ppl_kec
 * @property integer $ppl_ims
 * @property integer $ppl_aids
 * @property integer $ppl_jumlah
 * @property integer $ppl_tahun
 *
 * The followings are the available model relations:
 * @property Kecamatan $pplKec
 */
class Puskesmaspelayanan extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Puskesmaspelayanan the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'puskesmaspelayanan';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('ppl_kec, ppl_ims, ppl_aids, ppl_jumlah, ppl_tahun', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('ppl_id, ppl_kec, ppl_ims, ppl_aids, ppl_jumlah, ppl_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'pplKec' => array(self::BELONGS_TO, 'Kecamatan', 'ppl_kec'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'ppl_id' => 'Ppl',
			'ppl_kec' => 'Ppl Kec',
			'ppl_ims' => 'Ppl Ims',
			'ppl_aids' => 'Ppl Aids',
			'ppl_jumlah' => 'Ppl Jumlah',
			'ppl_tahun' => 'Ppl Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('ppl_id',$this->ppl_id);
		$criteria->compare('ppl_kec',$this->ppl_kec);
		$criteria->compare('ppl_ims',$this->ppl_ims);
		$criteria->compare('ppl_aids',$this->ppl_aids);
		$criteria->compare('ppl_jumlah',$this->ppl_jumlah);
		$criteria->compare('ppl_tahun',$this->ppl_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}